$('#save').click(function () {
    var measureId = $('#measureId').val();
    if(measureId==''){
        layer.msg('磅单号不存在，请确认', {icon: 2});
        return false;
    }
    var tareP = $('#tareP').val();
    var grossWeight = $('#gross').val();
    var grossTime = $('#grossTime').val();
    var tare = $('#tare').val();
    var tareTime = $('#tareTime').val();
    var suttle = $('#suttle').val();
    var grossWeightp = $('#grossWeightP').val();
    var unloadSymbol = $('#unloadSymbol').val();
    var returnSymbol = $('#returnSymbol').val();
    var remarks1 = $('#remarks1').val();
    var supplierName = $('#supplierNameCode').val();
    var customerName = $('#customerNameCode').val();
    var carId = $('#main-plate-no-pre').val()+$('#carId-f').val();
    var materialName = $('#materialNameCode').val();
    var sourceGross = $('#sourceGross').val();
    var sourceTare = $('#sourceTare').val();
    var sourceSuttle = $('#sourceSuttle').val();
    var remark2 = $('#remark2').val();
    var closeSymbol = $('#closeSymbol').val();

    var storageName = $('#storageName').val();
    var grossWeightSite = $('#grossWeightSite').val();
    var tareSite = $('#tareSite').val();
    var max = $('#max').val();

    if(supplierName=='益达'||supplierName=='益隆'){
        grossWeight = 0;
        grossWeightp = '';
        grossTime = '';
        grossWeightSite = '';
        // $('#tare').val( weight);
        // $('#tareP').val(people);
        // $('#tareTime').val( time);
        // $('#tareSite').val(position);
    }
    //收货商：采购业务,毛重,毛重时间，毛重司磅员
    if(customerName=='益达'||customerName=='益隆'){
        // $('#gross').val( weight);
        // $('#grossWeightP').val(people);
        // $('#grossTime').val( time)
        // $('#grossWeightSite').val(position);
        tare = 0;
        tareP = '';
        tareTime = '';
        tareSite = '';

    }

    $.ajax({
        url : '/measure-save',
        data : {measureId:measureId,grossWeight:grossWeight,grossTime:grossTime,tare:tare,tareTime:tareTime,suttle:suttle,grossWeightp:grossWeightp
            ,unloadSymbol:unloadSymbol,returnSymbol:returnSymbol,closeSymbol:closeSymbol,remarks1:remarks1,supplierName:supplierName,tareP:tareP,
            customerName:customerName,carId:carId,materialName:materialName,max:max,storageName:storageName,sourceGross:sourceGross,grossWeightSite:grossWeightSite,tareSite:tareSite,sourceTare:sourceTare,sourceSuttle:sourceSuttle,remark2:remark2},
        async: false,
        beforeSend: function(){
            layer.msg('保存中', {icon: 1});
        },
        success :function(data){
            layer.msg('保存完毕', {icon: 1});
            $('#save').addClass("disabled");
            $('#write').removeClass("disabled");
            // init();
        }
    })

});